$(function () {
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        // autoplay: 3000,
        loop: true,
        effect: 'coverflow',
        grabCursor: true,
        centeredSlides: true,
        slidesPerView: 'auto',
        coverflow: {
            rotate: 50,
            stretch: 0,
            depth: 100,
            modifier: 1,
            slideShadows: true
        },
        onSlideNextEnd: function (swiper) {
            var activeIndex = swiper.activeIndex,
                bacgUrl = $('.swiper-slide').eq(activeIndex).attr('data-bacg');
            $('.swiper-container').css('background-image', 'url(' + bacgUrl + ')');
            // $('.swiper-container').addClass('bacg');

        }
    });

    $('.eui-icon-dotted').click(function () {
        $('#share_footer').fadeIn(400);
    });

    // 点击取消分享按钮、及遮罩关闭分享框
    $('#btn_close_share_wrap').click(closeShareOverlay);
    $('#share_footer').click(closeShareOverlay);

    // 点击白底分享card，阻止事件冒泡关闭弹框
    $('#footer_share_card').click(cancelBubble);

    // 关闭事件冒泡
    function closeShareOverlay() {
        $('#share_footer').fadeOut(400);
    }

    $('.btn-show-siderbar').click(function(){
        $('#siderbar').animate({
            "right":'0'
        },500,function(){
            $('#page_banner').hide();
            $('#card_header').hide();
        });
    });
    $('#btn_back_siderbar').click(function(){
        $('#siderbar').animate({
            "right":'-100%'
        },500);
    });

    // 防止事件冒泡
    function cancelBubble(e) {
        //如果提供了事件对象，则这是一个非IE浏览器
        if (e && e.stopPropagation)
            //因此它支持W3C的stopPropagation()方法
            e.stopPropagation();
        else
            //否则，我们需要使用IE的方式来取消事件冒泡
            window.event.cancelBubble = true;
    }
});